﻿using MediatR;
using RBAC.Domain.Service.Impl;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.LeaveCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.LeaveHanders
{
    public class LeaveDelCommandHandler : IRequestHandler<LeaveDelCommand, int>
    {
        private readonly ILeaveService _leaveService;
        public LeaveDelCommandHandler(ILeaveService leaveService)
        {
            _leaveService = leaveService;
        }

        public async Task<int> Handle(LeaveDelCommand request, CancellationToken cancellationToken)
        {
            return await _leaveService.DelLeave(new Leave() { LeaveId = request.leaveId, LeaveDel = true });
        }
    }
}
